

%---draw g, s and z: uu(1)->g, uu(2)->s, uu(3)->z
uu = rand(3,1);

for ig = 1:Ng
    if (uu(1)<=CDFg(iglp,ig)) 
        igtp = ig;
        break
    end
end

for is = 1:Ns
    if (uu(2)<=CDFs(islp,is))
        istp = is;
		break
    end
end 

for iz = 1:Nz
    if (uu(3)<=CDFz(iz))
        iztp = iz;
        break
    end
end
